<?php
global $post;

// media options
$defaults = array(
    'quality'   => 100,
//    'zc'        => false,
//    'zc_align'  => 'c',
    'embed'     => ''
);
$opts = get_post_meta( $post->ID, 'dt_post_thumb_opts_options', true );
$opts = wp_parse_args( $opts, $defaults );

// featured image hide option
$defaults = array(
    'his'    => false
);
$f_opts = get_post_meta( $post->ID, 'dt_featured_image_options', true );
$f_opts = wp_parse_args( $f_opts, $defaults );

$pass_prot = post_password_required();
?>

<div class="article">
    <h1><?php echo dt_first_letter_filter(get_the_title()); ?></h1>
    <div class="entry_meta">

		<a href="<?php the_permalink() ?>" class="add_date">
			<?php the_time(get_option('date_format')); ?>
		</a>
					  
		<a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>" class="blog_author">
			<?php echo get_the_author(); ?>
		</a>
		
		<?php if( comments_open() ): // comments ?>
            
            <?php
            $anchor = '#comments';
            if( !get_comments_number() ) {
                 $anchor = '#form_holder';
            }
            ?>
			<a href="<?php echo $anchor; ?>" class="comments_count">
			<?php
			comments_number(
				__( 'no comments yet', LANGUAGE_ZONE ),
				__( '1 comment', LANGUAGE_ZONE ),
				__( '% comments', LANGUAGE_ZONE )
			);
			?>
			</a>
			
		<?php endif; ?>

		<?php // category
		$categories = get_the_category_list( __( ', ', LANGUAGE_ZONE ) );
		if( $categories ):
		?>					
			<span class="blog_category">
				<?php echo $categories; ?>
			</span>
		<?php endif ?>
					
		<?php //tags
		$tags = get_the_tag_list( '', __( ', ', LANGUAGE_ZONE ) );
		if( $tags ):			
		?>              
			<span class="blog_tags">
				<?php echo $tags; ?>
			</span>
		<?php endif; ?>
		
    </div>
    
    <?php if( has_post_thumbnail() && empty($opts['embed']) && !$f_opts['his'] && !$pass_prot ): ?>
    
		<?php
		$thumb = dt_get_thumbnail(
            array(
                'post_id'	=> $post->ID,
                'width'		=> 590,
                'upscale'	=> false,//$opts['zc'],
                'quality'   => $opts['quality'],
                //'zc_align'  => $opts['zc_align']
            )        
        );
		?>
        
		<span class="blog_ico"><img src="<?php echo $thumb['thumnail_img']; ?>" alt="" <?php echo $thumb['size_str']; ?>/><i></i></span>
    <?php elseif( $opts['embed'] && !$f_opts['his'] && !$pass_prot ): ?>
    
        <?php
        $opts['embed'] = sprintf(
            '[embed width=%d]%s[/embed]',
            592,
            $opts['embed']
        );
        ?>
        <span class="blog_ico"><?php
            $opts['embed'] = apply_filters( 'the_content', $opts['embed']);
            echo str_replace( array('<p>', '</p>'), '', $opts['embed'] );
            ?></span>
            
    <?php endif; ?>
    
    <?php
    the_content();

    wp_link_pages(
        array(
            'before'        => '<div class="paginator inblog details"><div class="pages">',
            'after'         => '</div></div>',
            'pagelink'      => '<span>%</span>'
        )
    );
    ?>
    
    <?php dt_edit_link(); ?>
    
</div>

<div class="article_footer">
    <div class="article_footer_s comments" id="comments">
        <?php comments_template(); ?>
    </div>
</div>